package project3;

import edu.princeton.cs.algs4.*;
import project3.dijkstra.DijkstraSp2;

import java.io.File;
import java.util.Scanner;

/**
 * 初始化工具类
 * */
public class Test3 {

    public static void init_Point(In in,Point[] ps){
        for(int i = 0; i<ps.length;i++){
            int p = in.readInt();
            double x = in.readDouble();
            double y = in.readDouble()+50;
            ps[i] = new Point(x, y);
        }
    }

    public static void init_Graph(In in,int b,EdgeWeightedGraph edgeWeightedGraph, Point[] ps){
        for(int i = 0;i<b;i++){
            int p = in.readInt();
            int q = in.readInt();
            double weight = ps[p].distanceTo(ps[q]);
            edgeWeightedGraph.addEdge(new Edge(p, q, weight));
        }
    }

    public static void init_Graph2(In in,int b,EdgeWeightedDigraph mGriph, Point[] ps){
        for(int i = 0;i<b;i++){
            int p = in.readInt();
            int q = in.readInt();
            double weight = ps[p].distanceTo(ps[q]);
            mGriph.addEdge(new DirectedEdge(p, q, weight));
        }
    }

}
